﻿Imports System.Windows.Forms

Public Class DevicePanel
    Inherits Panel

    Private BackPic As New BackgroundCreator
    Public Sub New()
        Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
        Me.SetStyle(ControlStyles.OptimizedDoubleBuffer, True)
        Me.SetStyle(ControlStyles.SupportsTransparentBackColor, True)
        Me.UpdateStyles()
        Me.BackgroundImage = BackPic.CreatePic(Me.Width, Me.Height, Me.BackColor)
    End Sub

    Protected Overrides Sub Finalize()
        MyBase.Finalize()
    End Sub

    Private Sub DevicePanel_BackColorChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.BackColorChanged
        Me.BackgroundImage = BackPic.CreatePic(Me.Width, Me.Height, Me.BackColor)
    End Sub

    Private Sub DevicePanel_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
        Me.BackgroundImage = BackPic.CreatePic(Me.Width, Me.Height, Me.BackColor)
    End Sub
End Class
